﻿using UnityEngine;
using System.Collections;

namespace UI
{
    public class UIUnionRunMap : Page
    {
        public static bool isUIUnionRunMap = false;
        public UserHead userHead;

        protected override void DoOpen()
        {
            ManagerController.Instance.TownToUnion();
            
            Init();
            if (StaticData.townNeedLogin)
            {
                StaticData.townNeedLogin = false;
                if (GuideManager.Instance != null)
                {
                    GuideManager.Instance.OnLogin(false);
                }
            }
            
            isUIUnionRunMap = true;
        }

        void Init()
        {
            userHead.Fresh();
        }

        protected override void DoClose()
        {
            base.DoClose();
            ManagerController.Instance.UnionToTown();
            UIAutoSize.Instance.ShowMaskUI(true);
            isUIUnionRunMap = false;
        }

        public override void OnForceClose()
        {
            isUIUnionRunMap = false;
        }

        
    }
}
